<template>
	<view class="center">
		<!-- 标题 -->
		<view class="header-title" :style="{paddingTop:statuHeight+'px'}">视频上传</view>
		<!-- 步骤条 -->
		<uni-steps :options="options" active-color="#ffffff" :active="2"></uni-steps>
		<!-- 主体内容 -->
		<view class="main">
			<view class="title-input-box">
				<view class="video-title">视频标题</view>
				<input 
				placeholder="请输入视频标题" 
				placeholder-style="{font-size: 28rpx;font-family: PingFang SC;font-weight: 500;color: #5C2378;}"/>
			</view>
			<view class="title-input-box">
				<view class="video-title">视频描述</view>
				<input 
				placeholder="150字以内" 
				placeholder-style="{font-size: 28rpx;font-family: PingFang SC;font-weight: 500;color: #5C2378;}"/>
			</view>
			<!--视频分类 -->
			<view class="video-class-box">
				<view class="video-class">
					<view class="class-title">视频分类</view>
					<view class="picker-icons">
						<picker @change="bindPickerChange" :value="pickerText" :range="array">
							<view class="prcker-name">{{pickerText>-1?array[pickerText]:'请选择'}}</view>
						</picker>
						<uni-icons type="arrowdown" size="20"></uni-icons>
					</view>			
				</view>
				<view class="video-class">
					<view class="class-title">视频分类</view>
					<view class="picker-icons">
						<picker @change="bindPickerChange" :value="pickerText" :range="array">
							<view class="prcker-name">{{pickerText>-1?array[pickerText]:'请选择'}}</view>
						</picker>
						<uni-icons type="arrowdown" size="20"></uni-icons>
					</view>			
				</view>
			</view>
			<!-- 视频与封面图 -->
			<view class="video-homeImg">
				<!-- 图片上传 -->
				<view>
					<view class="add-img">
						<uni-icons type="plusempty" size="40" color="#CECECE"></uni-icons>
					</view>
					<view class="btn-updoal-img">点击上传封面</view>
				</view>
				<!-- 视频上传 -->
				<view>
					<view class="add-img">
						<uni-icons type="plusempty" size="40" color="#CECECE"></uni-icons>
					</view>
					<view class="btn-updoal-img">点击上传视频</view>
				</view>
			</view>
			<!-- 视频详情 -->
			<view>
				<view class="details-title">视频详情</view>
				<view class="textarea-num">
					<textarea class="uni-textarea" maxlength="150" @input="submit" v-model="formData.name"
						placeholder="请输入视频描述" placeholder-class="placeholder" :disable-default-padding="true"/>
					<view class="num"><text>{{remnant}}</text>/150</view>
				</view>
			</view>
			<!-- 底部 -->
			<view class="footer">
				<view class="reminder">温馨提示：</view>
				<view class="reminder-text">上传请耐心等待官方审核</view>
				<view class="btn-add">确认提交</view>
			</view>
			<!-- 定位的缺口 -->
			<view class="position-left"></view>
			<view class="position-left right"></view>
		</view>
		<tabber :tabIndex="2"></tabber>
	</view>
</template>

<script>
	import tabber from '@/components/tabbar.vue'
	export default {
		components:{tabber},
		data() {
			return {
				formData: {
					name:''
				},
				remnant:0,
				pickerText: -1,
				array: ['中国', '美国', '巴西', '日本'],
				statuHeight: uni.getSystemInfoSync().statusBarHeight,
				options: [
					{ title: "上传视频", desc: 1}, { title: "视频信息", desc: 2},
					{ title: "后台审核", desc: 3}, { title: "发布成功", desc: 4},
					{ title: "赚取佣金", desc: 4}
				]
			}
		},
		onShow() {
			// 隐藏官方tabber
			uni.hideTabBar()
		},
		methods: {
			bindPickerChange(e) {
				this.pickerText = e.target.value
			},
			// 富文本框input事件
			submit() {
				const vm = this
				console.log("长度:",vm.formData.name.length)
				vm.formData.name = vm.formData.name.replace(/\s+/g, "")
				vm.remnant = vm.formData.name.length
				if (vm.remnant == 150 || vm.remnant > 150) {
					vm.remnant = 150
				}
			}
		},
	}
</script>
<style lang="scss" scoped>
	.center{
		background-color: #5C2378;
		margin-bottom: 170rpx;
		padding-bottom: 33px;
		.header-title{
			padding-bottom: 20rpx;
			background-color: #5C2378;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			text-align: center;
		}
		/deep/ .uni-steps{
			margin: 68rpx 0 53rpx 0;
		}
		.main{
			margin: 0 28rpx;
			background-color: #FFFFFF;
			padding: 44rpx 24rpx 0 24rpx;
			border-radius: 20rpx;
			position: relative;
			// margin-bottom: 230rpx;
			.title-input-box{
				width: 641rpx;
				height: 89rpx;
				background-color: #F7F7F7;
				display: flex;
				align-items: center;
				border-bottom: 1rpx dashed #999999;
				.video-title{
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #222222;
					padding: 0 80rpx 0 28rpx;
				}
			}
			.video-class-box{
				padding: 33rpx 40rpx 28rpx  28rpx;
				background-color: #F7F7F7;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.video-class{
					width: 40%;
					
					.class-title{
						font-size: 20rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #222222;
						margin-bottom: 19rpx;
					}
					.picker-icons{
						display: flex;
						align-items: center;
						justify-content: space-between;
						.prcker-name{
							font-size: 28rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #5C2378;
						}
					}
				}
			}
			// 视频与封面图
			.video-homeImg{
				padding:102rpx 0 33rpx 0;
				border-bottom: 1rpx dashed #E6E6E6;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.add-img{
					width: 300rpx;
					height: 205rpx;
					background: #F7F7F7;
					border-radius: 10rpx;
					text-align: center;
					line-height: 205rpx;
				}
				.btn-updoal-img{
					width: 300rpx;
					height: 57rpx;
					background: #EE4242;
					border-radius: 0 0 12rpx 12rpx;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 57rpx;
					text-align: center;
				}
			}
			.details-title{
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #222222;
				padding: 24rpx 0;
			}
				.textarea-num {
					position: relative;
				// 多行输入框
				.uni-textarea {
					width: 100%;
					padding: 12px;
					height: 338rpx;
					border-radius: 4rpx;
					box-sizing: border-box;
					background: #F7F7F7;
					/deep/ .placeholder {
						font-size: 18rpx;
						font-weight: 400;
						color: rgba(51, 51, 51, 0.24);
					}
				}
				.num {
					font-size: 26rpx;
					font-weight: 400;
					text-align: right;
					position: absolute;
					color: rgba(0,0,0,0.24);
					right: 24rpx;
					bottom: 24rpx;
				}
			}
			// 底部
			.footer{
				padding-bottom: 97rpx;
				.reminder{
					font-size: 22rpx;
					font-family: Adobe Heiti Std;
					font-weight: normal;
					color: #333333;
					padding: 38rpx 0 27rpx 0;
				}
				.reminder-text{
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #9D9D9D;
					text-align: center;
					padding-bottom: 25rpx;
				}
				.btn-add{
					width: 540rpx;
					height: 88rpx;
					background: linear-gradient(90deg, #B83DF1, #852CAE);
					border-radius: 44rpx;
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 88rpx;
					text-align: center;
					margin: auto;
				}
			}
			// 定位的缺口
			.position-left{
				width: 65rpx;
				height: 44rpx;
				background-color: #5C2378;
				border-radius: 50%;
				transform:rotate(90deg);
				-ms-transform:rotate(90deg); /* IE 9 */
				-moz-transform:rotate(90deg); /* Firefox */
				-webkit-transform:rotate(90deg); /* Safari and Chrome */
				-o-transform:rotate(90deg); /* Opera */
				position: absolute;
				left: -21px;
				top:184px;
			}
			.position-left{
				width: 65rpx;
				height: 44rpx;
				background-color: #5C2378;
				border-radius: 50%;
				transform:rotate(90deg);
				-ms-transform:rotate(90deg); /* IE 9 */
				-moz-transform:rotate(90deg); /* Firefox */
				-webkit-transform:rotate(90deg); /* Safari and Chrome */
				-o-transform:rotate(90deg); /* Opera */
				position: absolute;
				left: -21px;
				top:184px;
			}
			.right{
				left: unset!important;
				right: -21px;
			}
		}
	}
	
</style>
